package lib.bone.flow.service;

import lib.bone.common.core.domain.PageResultDTO;
import lib.bone.common.core.domain.ResponseDTO;
import lib.bone.flow.domain.dto.FlowTaskDTO;
import lib.bone.flow.domain.dto.FlowTaskQueryByDTO;
import lib.bone.flow.domain.entity.FlowTask;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Pageable;


import java.util.List;
import java.util.Optional;

public interface FlowTaskService  {


    void deleteList(List<String> ids);

    /**
     * 获取全部
     * @return
     */
    List<FlowTask> getAll();

    /**
     * 构建服务名
     */
    void buildServiceName(FlowTask task);

    /**
     * 根据流程实例批量删除
     * @param flowWorkId
     */
    void deleteFlowTasks(String flowWorkId);

    /**
     * 获取该流程任务分配信息
     * @param flowWorkId
     * @param taskStatus
     * @return
     */
    List<FlowTask> getFlowTasks(String flowWorkId,String taskStatus);

    /**
     * 新建一条记录
     * @param flowTask
     * @return
     */
    FlowTask saveOne(FlowTask flowTask);
    /**
     * 根据ID 获取
     * @param taskId
     * @return
     */
    Optional<FlowTask> getById(String taskId);

    /**
     * 保存多个记录
     */
    List<FlowTask> saveList(List<FlowTask> tasks);

    /**
     * 根据条件查询
     * @param flowWorkId
     * @param flowNodeId
     * @return
     */
    List<FlowTask> getByFlowWorkIdAndFlowNodeId(String flowWorkId,String flowNodeId);


    /**
     * 统计查询
     */
    Long countTaskStatus(String taskStatus,String actUserId);

    /**
     * 根据用户id和项目id查询
     * @param actUserId
     * @param serviceId
     * @return
     */
    Optional<FlowTask> findByActUserIdAndServiceId(String actUserId,String serviceId);

    ResponseDTO getList(Pageable pageable, Example<FlowTask> example);

    PageResultDTO searchList(Pageable pageable, Example<FlowTask> example);

    Optional<FlowTask> findByFlowWorkId(String flowWorkId);

    List<FlowTask> getByInitiator(String initiator);

    List<FlowTask> getByServiceId(String id);

}
